

import jsonwebtoken from 'jsonwebtoken'
const secret = 'xyz'
// function myjwt(data) {
// }

export default (data) => {
    let jwtData = {}
    jsonwebtoken.verify(data, secret, (err, dacode) =>{
        if(err) {
            localStorage.removeItem('User-Token')
            alert('登录过期重新登录')
            window.location.href = '/login'
        }else {
            jwtData = dacode
        }
    })
    return jwtData
}